package com.nice.email.handler;

import com.nice.email.dto.vo.MailSendVo;
import com.nice.email.util.MailUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author zhaobaolin
 * @Date 2018/10/26
 */
@Component
public class IndexHandler {

    @Autowired
    private MailUtil mailUtil;

    public MailSendVo index(String addr) throws Exception
    {
        MailSendVo mailSendVo = new MailSendVo();
        mailSendVo.setToMail(addr);
        mailSendVo.setTitle("测试邮件");
        mailSendVo.setContent("这是发送的内容");
        boolean result = mailUtil.send(mailSendVo);
        return result ? mailSendVo : null;
    }
}
